package com.ddwl.data.dao;

import com.ddwl.common.dao.TkDao;
import com.ddwl.schema.bo.data.ChannelConfigPageBo;
import com.ddwl.data.mapper.ChannelConfigMapper;
import com.ddwl.data.model.ChannelConfig;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author hemiaojun
 * @Date 2020/11/9 14:56
 */
@Repository
public class ChannelConfigDao extends TkDao<ChannelConfigMapper, ChannelConfig> {

    @Resource
    private ChannelConfigMapper channelConfigMapper;


    public List<ChannelConfig> getList(ChannelConfigPageBo param) {
        Example example = getExample();
        example.and().andEqualTo("name", param.getName())
                .andEqualTo("code", param.getCode());
        return channelConfigMapper.selectByExample(example);
    }

    public List<ChannelConfig> getAll() {
        Example example = new Example(ChannelConfig.class);
        return channelConfigMapper.selectByExample(example);
    }

    public void changeId(Map<String,String> map) {
        channelConfigMapper.changeId(map);
    }
}
